<template>
  <div class="card-out-container">
    <a-form layout="inline" v-if="showMore" class="multi-line-search-form" id="wipSearchBoxId">
      <template v-for="(item , index) in wipListSearchParams" :key="index">
        <a-form-item :label="item.title" v-if="item.show">
          <a-input v-if="item.type=='input'" :maxLength="item.maxLength" v-model:value.trim="queryParam[item.key]" :placeholder="`${$t('common.pleaseInput')}${item.title}`" @keyup.enter="loadData" allowClear />
          <a-select v-model:value="queryParam[item.key]" :placeholder="`${$t('common.pleaseSelect')}${item.title}`" v-if="item.type == 'select'" allowClear mode="multiple">
            <a-select-option v-for="(el,i) in getSelectOpt(item.key)" :value="el.name || el.key" :key="i">{{ el.name|| el.label }}</a-select-option>
          </a-select>
          <a-cascader v-if="item.type == 'cascader'" v-model:value="queryParam[item.key]" :show-search="{ filter:filterStation }" :fieldNames="fieldNames" :options="stationNoListAry" :placeholder="$t('other.pleaseSelectStation')" style="min-width: 200px" />
          <a-range-picker v-if="item.type=='time'" v-model:value="queryParam[item.key]" :placeholder="[$t('common.startDate'), $t('common.endDate')]" format="YYYY-MM-DD" valueFormat="YYYY-MM-DD" />
        </a-form-item>
      </template>
      <a-form-item>
        <a-space>
          <a-button type="primary" @click="loadData">{{ $t('common.see') }}</a-button>
          <a-button @click="searchReset">{{ $t('common.reset') }}</a-button>
          <a-button type="link" @click="filterSearch">{{ $t('components.filterSet') }}</a-button>
        </a-space>
      </a-form-item>
    </a-form>
    <CustomTable storeTableName="wipInfoTable" rowKey="id" :loading="loading" :dataSource="dataSource" :columns="columns" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, fixed: 'left'}" :pagination="ipagination" :scroll="{x:1000, y: tableHeight }" @change="handleTableChange" :showMore="showMore" :operateMargin="true" :rowClassName="rowClassName" :resizeColumns="true" :columnFilter="{text:'showCabin', val: showCabin }">
      <template #operateLeft>
        <div class="operate-left">
<!--          <a-button v-if="isEnvLocal" type="primary" @click="syncData(syncDataAry)">同步</a-button>-->
          <span>
            <a-button type="primary" @click="operateClick({value: 1})"  v-if="hasPermission('mo:workinprocess:add')">{{ $t('common.addNew') }}</a-button>
            <a-button type="warning" ghost :disabled="!this.selectedRowKeys.length" @click="delEditStatus"  v-if="hasPermission('mo:workinprocess:delete')">{{ $t('common.delMore') }}</a-button>
            <!--            <a-button type="primary" ghost :disabled="!this.selectedRowKeys.length" @click="moreEditStatus(2)">{{ $t('common.completeMore') }}</a-button>-->
            <a-button type="primary" ghost v-if="hasPermission('hanger:accomplish:edit')" :disabled="!this.selectedRowKeys.length" @click="finishedSchAllList">{{ $t('common.completeMore') }}</a-button>
            <a-button type="primary" ghost :disabled="!this.selectedRowKeys.length" @click="batchExportXls(url.exportUrl, '在制品信息', true)">批量导出</a-button>
            <a-button type="primary" ghost @click="()=> handleExportXls(url.exportUrl, $t('other.onMakeMsg'), true)">{{ $t('common.outputExcel') }}</a-button>
          </span>
        </div>
      </template>
      <template #operateRight>
        <div class="slot-operate-right">
          <a-input-search v-model:value.trim="fuzzySearch" enter-button :placeholder="$t('hangManage.scheduledNo')" v-if="!showMore" @search="loadData" />
          <a-button class="ml-10" @click="toggleMore" type="primary" ghost>{{ $t('common.highFilter') }}</a-button>
        </div>
      </template>
      <template #bodyCell="{ scope }">
        <template v-if="scope.column.key === 'status'">
          <a-tag color="default" v-if="scope.record.status == 1">{{ $t('other.toProduced') }} </a-tag>
          <a-tag color="processing" v-if="scope.record.status == 2">{{ $t('other.inProduct') }}  </a-tag>
          <a-tag color="error"  v-if="scope.record.status == 3">{{ $t('other.reworkAndReturnToWarehouse') }} </a-tag>
          <a-tag  style="border: 1px solid #98E6FF;background-color: #E6F7FD;  color:#37CEFF" v-if="scope.record.status == 5">{{ $t('other.reworkOutOfWarehouse') }} </a-tag>
          <a-tag color="warning" v-if="scope.record.status == 6">{{ $t('other.holdOut') }} </a-tag>
        </template>
        <template v-if="scope.column.key === 'cutBinStatus'">
          <span v-if="scope.record.cutBinStatus"></span>
          <span v-else>
            {{scope.record.cutBinStatus == 1 ? t('other.stopOut'): t('other.normalDischarge') }}
            <a-button type="link" class="primary-link" @change="onCutChange(scope.record.cutBinStatus)">
              {{ $t('other.toggle') }}
            </a-button>
          </span> 
        </template>
        <template v-else-if="scope.column.key === 'moNo'">
          <span class="code-link" v-if="scope.record.moNo && `${scope.record.moNo}`.length<=8" @click="viewMo(scope.record)">{{scope.record.moNo}}</span>
          <a-tooltip v-else>
            <template #title>
              <span>{{scope.record.moNo}}</span>
            </template>
            <span class="code-link" @click="viewMo(scope.record)">{{scope.record.moNo}} </span>
          </a-tooltip>
        </template>
        <template v-else-if="scope.column.key === 'sortingFinishedProductIn'">
          <a-switch :checked="Boolean(scope.record.sortingFinishedProductIn)" @change="(value) => onCabinChange(value, scope.record)" />
        </template>
        <template v-else-if="scope.column.key === 'sortingFinishedProductInCode'">
          <a-select v-model:value="scope.record.sortingFinishedProductInCode" size="small" :placeholder="$t('common.pleaseSelect')" :options="productInList" @change="onCabinChange('incode', scope.record)"></a-select>
        </template>
        <template v-else-if="scope.column.key === 'roadMapName'">
          <span class="code-link" v-if="scope.record.roadMapName && `${scope.record.roadMapName}`.length<=8" @click="goRouteChart(scope.record)">{{scope.record.roadMapName}}</span>
          <a-tooltip v-else>
            <template #title>
              <span>{{scope.record.roadMapName}}</span>
            </template>
            <span class="code-link" @click="goRouteChart(scope.record)">{{scope.record.roadMapName && `${scope.record.roadMapName}`.split(0, 6) + '...'}}</span>
          </a-tooltip>
          <edit-outlined class="code-link ml-8" @click="goRouteChart(scope.record, true)" v-if="hasPermission('mo:workinprocess:edit')"/>
        </template>
        <template v-else-if="scope.column.key === 'overProduceQty'">
          <span>{{scope.record.overProduceQty}}</span>
          <a-popconfirm :ok-text="$t('common.ok')" :cancel-text="$t('common.cancel')" @confirm="onPopConfirm(scope.record)" @cancel="onPopCancel" v-if="hasPermission('mo:workinprocess:edit')">
            <template #icon> <span></span> </template>
            <template #title>
              <a-form ref="popFormRef" style="margin-left: -22px;" :model="formState">
                <!-- <a-form-item :label="$t('hangManage.allowOverPro')" name="overProduceQty" :rules="[{ validator: validateQty, trigger: 'change' }]"> -->
                  <a-form-item :label="$t('hangManage.allowOverPro')" name="overProduceQty" >
                  <a-input-number v-model:value="formState.overProduceQty" :placeholder="$t('common.pleaseInput')" :min="0" allowClear :controls="false" />
                </a-form-item>
              </a-form>
            </template>
            <edit-outlined class="code-link ml-8" @click="editOverfulfil(scope.record.overProduceQty)" />
          </a-popconfirm>

        </template>
        <template v-else-if="scope.column.key === 'operate'">
          <span class="table-operate-container">
            <a-button type="link" class="primary-link" @click="operateClick({value: 2},scope.record)" v-if="hasPermission('mo:workinprocess:edit')">{{$t('common.editor')}}</a-button>

            <!-- <span v-if="reworkInput.reworkReturnToDepot == 0 && scope.record.status == 2">
              <a-divider type="vertical" />
              <a-button type="link" danger class="primary-link" @click="operateClick({value: 11},scope.record)" v-if="true">{{$t('other.reworkAndReturnToWarehouse')}}</a-button>
            </span>
            <span v-if="reworkInput.reworkReturnToDepot == 0  && scope.record.status == 3 ">
              <a-divider type="vertical" />
              <a-button type="link" class="primary-link" @click="operateClick({value: 12},scope.record)" v-if="true">{{$t('other.goOnProd')}}</a-button>
            </span>
            <span v-if="reworkInput.reworkReturnToDepot == 0  && scope.record.status == 5 ">
              <a-divider type="vertical" />
              <a-button type="link"  danger class="primary-link" @click="operateClick({value: 13},scope.record)" v-if="true">{{$t('other.suspensionOfShipment')}}</a-button>
            </span>
            <span v-if="reworkInput.reworkReturnToDepot == 0  && scope.record.status == 6 ">
              <a-divider type="vertical" />
              <a-button type="link" class="primary-link" @click="operateClick({value: 12},scope.record)" v-if="true">{{$t('other.continuedDelivery')}}</a-button>
            </span> -->

            <span v-if="scope.record.status == 1">
              <a-divider type="vertical" />
              <a-button type="link" class="warning-link" @click="operateClick({value: 3}, scope.record)" v-if="hasPermission('mo:workinprocess:delete')">{{$t('common.del')}}</a-button>
            </span>

            <span v-if="scope.record.status == 2">
              <a-divider type="vertical" />
              <a-button type="link" class="primary-link" v-if="hasPermission('hanger:accomplish:edit')" @click="finishedSchList( scope.record.id)">{{$t('layout.complete')}}</a-button>
            </span>
          </span>
        </template>
      </template>
    </CustomTable>
    <FilterParamsModal ref="filterParamsModalRef" @ok="onParamsConfigOK" />
    <addRouteModal ref="addRouteModalRef" @ok="loadData" />
    <editRouteModal ref="editRouteModalRef" @ok="loadData" />
    <viewRouteModal ref="viewRouteModalRef" @operateRoute="onRouteModalOperate" />

    <ReworkWarehouse ref="reworkWarehouseRef" @operateData="reworkWarehouseOperate" />
  </div>
</template>

<script>
import { ListMixinPm } from '@/mixin/listMixinPm.js'
// import { DownOutlined } from '@ant-design/icons-vue'
import { EditOutlined } from '@ant-design/icons-vue'
import { listColumns, wipListSearchParams } from './modules/wipConfig'
import { cloneDeep } from 'lodash'
import { filterObj, startTimeValue, endTimeValue, getLocalStorage, getFieldText, getText, hasPermission } from '@/utils'
import CustomTable from '@/components/commonTable/customTable.vue'
import FilterParamsModal from '@/components/filterParamsModal/filterParamsModal.vue'
import { store } from '@/store'
import { mapState } from 'vuex'
import { message } from "ant-design-vue"
import axios from "@/utils/request"
import addRouteModal from '@/views/makeManage/routeChart/modules/addRouteModal.vue'
import editRouteModal from '@/views/makeManage/routeChart/modules/editRouteModal.vue'
import viewRouteModal from '@/views/makeManage/routeChart/modules/viewRouteModal.vue'
import ReworkWarehouse from "@/views/hangManage/wipInfo/modules/reworkWarehouse";
export default {
  name: 'wipInfo',
  mixins: [ListMixinPm],
  components: {
    ReworkWarehouse,
    // DownOutlined
    EditOutlined,
    CustomTable,
    FilterParamsModal,
    addRouteModal,
    editRouteModal,
    viewRouteModal
  },
  computed: {
    ...mapState({
      productPartAry: state => state.normalData.partList,
      sectionNameAry: (state) => state.normalData.sectionList,
      tabs: state => state.setting.tabs,
      sortingFinishedProductIn: (state) => state.setting.sortingFinishedProductIn,
    })
  },
  data () {
    return {
      url: {
        list: '/api/hanger/schedule-bill/list',
        delete: '/api/hanger/schedule-bill/delete',
        save: '/api/hanger/schedule-bill/update-schedulebill-status',
        exportUrl: '/api/hanger/schedule-bill/export-schedule-bill',
        station: '/api/device/hanger-line-bridge/three-level-pull-down',
        cutStstus: '/api/hanger/schedule-bill/update-cut-bin-status',
        changeCabin: '/api/hanger/schedule-bill/update-schedulebill-sorting-finished-product-in'
      },
      columns: listColumns,
      operateInfo: [
        { value: 6, label: this.$t('other.lookRoadMap') },
        { value: 7, label: this.$t('other.lookLineHangerMsg')  },
        { value: 8, label: this.$t('other.lookMakeMsg') }
      ],
      fuzzySearchName: 'styleNo',
      editkey: 3, // 批量操作显示问题,
      searchTimeAry: ['Time', 'RealFinishTime'],
      wipListSearchParams: [],
      statusAry: [
        { key: 1, label: this.$t('other.toProduced'), type: 'default' },
        { key: 2, label: this.$t('other.inProduct'), type: 'processing' },
        // { key: 3, label: '待生产', type: 'warning' }
      ],
      stationNoListAry: [],
      fieldNames: {
        label: 'name',
        value: 'value',
        children: 'children'
      },
      formState: {},
      multipleSelect: ['status', 'productPart', 'sectionName'],
      reworkInput:{},
      productInList: [ 
        {label: "大烫成品入库", value: '140'},
        {label: "复查成品入库", value: '150'},
        {label: "包装成品入库", value: '160'}
      ],
      showCabin: 0
    }
  },
  methods: {
    hasPermission,
    async onCutChange(val) {
      try {
        const res = await axios.postAction(this.url.cutStstus, {})
        if(res?.success) this.loadData()
      } catch {

      console.log("🚀 ~ file: index.vue:185 ~ onCutChange ~ val:", val)
      }
    },
    handleDrawDetail (record) {
      console.log(record)
      this.$router.push({
        path: '/makeManage/makeList/details',
        query: { id: record.moId },
      })
    },
    rowClassName (record) {
      if (record.status == 2) return 'trBackgroundColor'
    },
    editOverfulfil (val) {
      this.formState.overProduceQty = val
      this.$nextTick(() => {
        this.$refs.popFormRef.clearValidate()
      })
    },
    viewMo (record) {
      this.$router.push({
        path: '/makeManage/makeList/details',
        query: { id: record.moId }
      })
    },
    getFieldText,
    getText,
    getSelectOpt (key) {
      return this[`${key}Ary`]
    },
    totalTasks () {
      let totalNo = this.dataSource.reduce((prev, next) => {
        return prev + (next.produceQty || 0)
      }, 0)
      return totalNo
    },
    getQueryParams () {
      let param = this.showMore ? cloneDeep(this.queryParam) : {}
      if (!this.showMore) param[this.fuzzySearchName] = this.fuzzySearch
      param.stationNoList = this.queryParam.stationNoList ? (this.queryParam.stationNoList[2] ? [this.queryParam.stationNoList[2]] : null) : null
      this.searchTimeAry && this.searchTimeAry.forEach(i => {
        if (this.queryParam[i] && this.queryParam[i].length) {
          param[`start${i}`] = startTimeValue(this.queryParam[i][0])
          param[`end${i}`] = endTimeValue(this.queryParam[i][1])
        }
        delete param[i]
      })
      this.multipleSelect && this.multipleSelect.forEach(i => {
        if (this.queryParam[i] && !this.queryParam[i].length) {
          param[i] = null
        }
      })
      param.sortingFields = this.isorter.field ? [this.isorter] : null
      param.pageNo = this.ipagination.current
      param.pageSize = this.ipagination.pageSize
      return filterObj(param)
    },
    async delEditStatus () {
      console.log(this.selectionRows)
      let judge = 0;
      this.selectionRows && this.selectionRows.forEach(item => { if (item.status !== 1) { judge = 1; } })
      if (judge === 1) {
        message.error(this.$t('other.exitNotDel'))
      } else {
        this.editkey = 1;
        // console.log(this.editkey)
        const idsArray = cloneDeep(this.selectedRowKeys);
        if (idsArray && idsArray.length > 0) {
          this.confirmChangeStatus(this.url.delete,idsArray, '是否确定删除数据？', '提示', 'deleteAction')
        }
      }
    },
    operateClick (item, record) {
      // console.log('&&&&', item);
      switch (item.value) {
        case 1:
          this.$router.push('/hangManage/wipInfo/add')
          break;
        case 2:
          this.$router.push({
            path: '/hangManage/wipInfo/edit',
            query: { id: record.id }
          })
          break;
        case 3:
          this.handleDelete(record.id)
          break;
        case 4:  // 产品上线
          this.confirmChangeStatus(this.url.save, [{ id: record.id, status: 1 }], this.$t('other.sureLine'))
          break;
        case 5:  // 标记为完成状态
          this.confirmChangeStatus(this.url.save, [{ id: record.id, status: 2 }], this.$t('other.sureCompleteState')+'?')
          // '完成数量没有达到任务数量！'
          break;
        case 6:  // 查看工艺路线图
          break;
        case 7:  // 查看线上衣架信息

          break;
        case 8:  // 查看制单信息
          if (!record.moId) {
            this.$message.warning(this.$t('other.noMakeId'))
          } else {
            this.$router.push({
              path: '/makeManage/makeList/details',
              query: { id: record.moId }
            })
          }
          break;
        case 9:  // 标记为完成状态
          this.confirmChangeStatus(this.url.save, [{ id: record.id, status: 2 }], this.$t('other.goOnProd')+'?')
          break;
        case 10:
          this.confirmChangeStatus(this.url.save, [{ id: record.id, status: 3 }], this.$t('other.pauseProd')+'?')
          break;
        case 11:
            this.$refs.reworkWarehouseRef.open(record)
          break;
        case 12:
          this.continueWork(record)
          break;
        case 13:
          this.pauseWork(record)
          break;

        default:
          break;
      }
    },
    reworkWarehouseOperate(){
      this.loadData()
    },
    async continueWork(record){
      const res = await axios.getAction('/api/hanger/schedule-bill/intermittent-production', {scheduleBillId:record.id})
      if (res.success){
        this.$message.success('操作成功')
      }else{
        this.$message.error('操作失败')
      }
      this.loadData()
    },
    async pauseWork(record){
      const res = await axios.getAction('/api/hanger/schedule-bill/suspend-out-warehouse', {scheduleBillId:record.id})
      if (res.success){
        this.$message.success('操作成功')
      }else{
        this.$message.error('操作失败')
      }
      this.loadData()
    },
    async finishedSchList (record) {
      if (!record) {
        return false
      }
      try {
        const res = await axios.postAction('/api/hanger/schedule-bill/check-schedulebill-finished', [{ "id": record }])
        let text = ''
        if (res.data) {
          text = this.$t('other.sureCompleteState')
        } else {
          text = this.$t('other.notEnough')
        }
        this.confirmChangeStatus(this.url.save, [{ id: record, status: 4 }], text)
      } catch (err) {
        message.warn(this.$t('other.markWinFail') )
      }
    },
    async finishedSchAllList () {
      let judge = 0;
      this.selectionRows && this.selectionRows.forEach(item => {
        if (item.status == 1) {
          judge = 1;
        }
      })
      if (judge === 1) {
        message.error(this.$t('other.unconsumable'))
      } else {
        try {
          let array1 = []
          const idsArray = cloneDeep(this.selectedRowKeys)
          idsArray && idsArray.forEach(item => { array1.push({ id: item, status: 4 }) })
          const res = await axios.postAction('/api/hanger/schedule-bill/check-schedulebill-finished', array1)
          let text = ''
          if (res.data) {
            text = this.$t('other.batchSureCompleteState')+'?'
          } else {
            text = this.$t('other.batchNotEnough')+'?'
          }
          this.confirmChangeStatus(this.url.save, array1, text)
        } catch (err) {
          message.warn(this.$t('other.markFail'))
          console.log(err)
        }
      }
    },
    async goRouteChart (record, isEdit) {
      let queryParams = {
        moId: record.moId,
        routeId: record.roadMapId,
        isShowAdd: this.hasPermission('mo:workinprocess:add'),
        isShowEdit: this.hasPermission('mo:workinprocess:edit')
      }
      isEdit ? this.$refs.editRouteModalRef.open(queryParams) : this.$refs.viewRouteModalRef.open(queryParams)
    },
    async onRouteModalOperate (type, record) {
      type == 'add' ? await this.$refs.addRouteModalRef.open(record) : await this.$refs.editRouteModalRef.open(record)
      this.$refs.viewRouteModalRef && this.$refs.viewRouteModalRef.onCancle()
    },
    async getThreeList () {
      const res = await axios.postAction(this.url.station)
      if (res.success) {
        let data = res.data
        data.forEach(i => {
          i.value = i.lineNo
          i.children = i.masterTrackList
          i.children && i.children.forEach(el => {
            el.value = el.id
            el.children = el.stationList
            el.children && el.children.forEach(i => {
              i.name = i.stationNo
              i.value = i.stationNo
            })
          })
        })
        this.stationNoListAry = data
      }
    },
    initTableHeight () {
      this.$nextTick(() => {
        if (this.showMore) {
          let formHeight = `${document.getElementById('wipSearchBoxId').clientHeight + 340}px`
          this.tableHeight = `calc(100vh - ${formHeight})`
        } else {
          this.tableHeight = 'calc(100vh - 320px)'
        }
      })
    },
    filterSearch () {
      this.$refs.filterParamsModalRef.open(this.wipListSearchParams)
    },
    onParamsConfigOK (checkedAry) {
      this.wipListSearchParams.forEach(i => {
        i.show = checkedAry.includes(i.key)
      })
      localStorage.setItem('wipListSearchParams', JSON.stringify(this.wipListSearchParams))
      this.initTableHeight()
    },
    filterStation (inputValue, path) {
      return path.some(option => option && option.name.toString().indexOf(inputValue) > -1)
    },
    async validateQty (_rule, value) {
      let allowMaxOverproduction = getLocalStorage('allowMaxOverproduction') || 0
      if (!value && value !== 0) {
        return Promise.reject(this.$t('common.pleaseInput'));
      } else if (value > allowMaxOverproduction) {
        return Promise.reject( this.t('other.maxSysNo'));
      } else {
        return Promise.resolve();
      }
    },
    async onPopConfirm (scope) {
      let value = await this.$refs.popFormRef.validateFields()
      if (value) {
        let params = { "id": scope.id }
        if (this.formState.overProduceQty || this.formState.overProduceQty === 0) {
          params.overProduceQty = this.formState.overProduceQty
        } else {
          return
        }
        try {
          const res = await axios.postAction('/api/hanger/schedule-bill/update-overProduceQty', params)
          if (res.success) {
            message.success(this.$t('common.doSuccess'))
            this.formState = {};
            this.loadData()
          }
        } catch (err) {
          console.log(err)
        }
      } else {
        message.warn(this.$t('other.verificationFail'))
      }
    },
    onPopCancel () {
      this.$refs.popFormRef.clearValidate()
    },
    batchExportXls (exportUrl, fileName, needParams = false) {
      let scheduleBillIdList = [];
      this.selectionRows && this.selectionRows.forEach(item => {
        scheduleBillIdList.push(item.id)
      })
      if (!fileName || typeof fileName != 'string') {
        fileName = '导出文件'
      }
      let param = this.getQueryParams()
      param.scheduleBillIdList = scheduleBillIdList
      axios.downFile(exportUrl, needParams ? param : null).then((data) => {
        if (!data) {
          return
        }
        if (typeof window.navigator.msSaveBlob !== 'undefined') {
          window.navigator.msSaveBlob(new Blob([data]), fileName + '.xlsx')
        } else {
          let url = window.URL.createObjectURL(new Blob([data]))
          let link = document.createElement('a')
          link.style.display = 'none'
          link.href = url
          link.setAttribute('download', fileName + '.xlsx')
          document.body.appendChild(link)
          link.click()
          document.body.removeChild(link) // 下载完成移除元素
          window.URL.revokeObjectURL(url) // 释放掉blob对象
        }
        this.onClearSelected();
      })
    },
    async onCabinChange(val, record) {
      let status = val == 'incode' ? record.sortingFinishedProductIn : val ? 1 : 0
      let params = {
        id: record.id,
        sortingFinishedProductIn: status,
        sortingFinishedProductInCode:  record.sortingFinishedProductInCode
      }
      try {
        const res = await axios.postAction(this.url.changeCabin, params)
        if (res.success) {
          message.success('操作成功') 
          this.loadData()
        }
      }catch {
        console.log('仓状态更改失败');
      }
    }
  },
  async created () {
    let showVal = this.sortingFinishedProductIn || (localStorage.getItem('sortingFinishedProductIn') || 0) 
    this.showCabin = showVal == 1 
    console.log("🚀 showCabinshowCabinshowCabinshowCabin", this.showCabin)
    // this.columns = showCabin == 1 ? listColumns : listColumns.filter(i=> !i.hiddenCabin)  
    this.wipListSearchParams = getLocalStorage('wipListSearchParams') || wipListSearchParams
    await store.dispatch('getPart')
    await store.dispatch('getSection')
    await this.getThreeList()
    this.reworkInput = getLocalStorage('configuration') || {}
  }
}
</script>